# -*- coding:utf-8 -*-
import urllib2,time

isDomainNameAvailableCgi = "http://pandavip.www.net.cn/check/check_ac1.cgi?domain="

domainNameFile = r"/Users/janksenhu/Documents/aptanaStudioWorkspace/domain-name-digger/doName.txt"

domainName = ["girls","boys",'baby']
# domain = [".com",".net",".cn",".cc"]
domain = [".cc"]

#直接在domainName里面配置需要查询的域名
# for name in domainName:
#     for dom in domain:
#         temCgi = isDomainNameAvailableCgi+name+dom
#         result = urllib2.urlopen(temCgi, None, 5).read()#返回值：("cc|sogauiiiuujkk.cc|210|Domain name is available");
#         strs = result.split("|")
#         print name+dom,": ",strs[3]
#         time.sleep(1)
#     time.sleep(2)


#把所有需要查询的域名放在文件里面    
fileT = open(domainNameFile)        
while True:
    lines = fileT.readlines(10000)
    if not lines:
        break
    for line in lines:
        for dom in domain:
            temCgi = isDomainNameAvailableCgi+line.strip()+dom
            result = urllib2.urlopen(temCgi, None, 5).read()#返回值：("cc|sogauiiiuujkk.cc|210|Domain name is available");
            strs = result.split("|")
            print line.strip()+dom,": ",strs[3]
            time.sleep(1)
        time.sleep(2)